/*
 * @Descripttion: GGB
 * @version: 1.0
 * @Author: GGB
 * @Date: 2021-08-20 15:23:33
 * @LastEditors: GGB
 * @LastEditTime: 2021-08-20 16:00:30
 */
import 'package:flutter/material.dart';
import 'package:flutter_data_center/components/animation_text.dart';
import 'package:flutter_data_center/controller/teacher_attendance_controller.dart';
import 'package:flutter_data_center/utills/color_utils.dart';
import 'package:get/get.dart';

class DetailStatictis extends StatelessWidget {
  const DetailStatictis({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) => GetBuilder<TeacherAttendanceController>(
        builder: (_controller) => Container(
          width: double.infinity,
          padding: EdgeInsets.symmetric(horizontal: 20, vertical: 30),
          decoration: BoxDecoration(
            color: gColor("#EBF5F5"),
            borderRadius: BorderRadius.circular(10),
          ),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              buildItem(_controller.detail.total, "天数"),
              SizedBox(height: 20),
              buildItem(_controller.detail.personal, "事假"),
              SizedBox(height: 20),
              buildItem(_controller.detail.sick, "病假"),
              SizedBox(height: 20),
              buildItem(_controller.detail.trip, "出差"),
              SizedBox(height: 20),
              buildItem(_controller.detail.other, "其他"),
            ],
          ),
        ),
      );

  Row buildItem(int count, String label) {
    return Row(children: [
      Text(
        label,
        style: TextStyle(
          fontSize: 16,
        ),
      ),
      Spacer(),
      AnimText(
        number: count,
        style: TextStyle(
          fontSize: 16,
          color: gColor("#08D187"),
        ),
      ),
      Text(
        "天",
        style: TextStyle(
          fontSize: 16,
          color: gColor("#08D187"),
        ),
      ),
    ]);
  }
}
